/* 
 * UrlyBirdStarter.java 09.06.2011
 *  
 *  
 * Candidate: Alessandra Otterbach
 * Prometric ID: Algisina1
 * Username: Algisina
 *  
 * Sun Certified Developer for Java 2 Platform, Standard Edition Programming 
 * Assignment (CX-310-252A)
 *  
 * This class is part of the Programming Assignment of the Sun Certified 
 * Developer for Java 2 Platform, Standard Edition certification program, must 
 * not be used out of this context and must be used exclusively by Sun 
 * Microsystems, Inc. 
 */
package suncertify.ps;

/**
 * Application Start Window. If the given argument is 'alone' or empty, the Main
 * Window will be opened. If the given argument is 'server', the Server Window
 * will be opened.
 * 
 * @author Alessandra Otterbach
 * 
 */
public class UrlyBirdStarter {

    public UrlyBirdStarter(String... args) {
	if (args.length == 0 || "alone".equalsIgnoreCase(args[0])) {

	    ApplicationRunMode mode = (args.length == 0) ? ApplicationRunMode.NETWORK_CLIENT
		    : ApplicationRunMode.STANDALONE_CLIENT;
	    // Create main application window in client or standalone mode
	    UrlyBirdMainWindow urlyBirdMainWindow = new UrlyBirdMainWindow(mode);
	    urlyBirdMainWindow.startGui();
	} else if ("server".equalsIgnoreCase(args[0])) {
	    // Create main application window in server mode
	    UrlyBirdServerWindow urlyBirdServerWindow = new UrlyBirdServerWindow();
	    urlyBirdServerWindow.startGui();
	} else {
	    System.err.println("Valid options are: ");
	    System.err
		    .println("'standalone' - client starts in non network mode");
	    System.err.println("'server' - client starts in network mode");
	}
    }

    public static void main(final String[] args) {
	new UrlyBirdStarter(args);
    }
}
